﻿<%@ Page Title="Add Purchase Requisition" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="purchreq.aspx.vb" Inherits="str_purchreq" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
    .auto-style3 {
        width: 260px;
    }
        .auto-style5 {
            width: 195px;
        }
        .auto-style6 {
            width: 167px;
        }
        .auto-style7 {
            width: 217px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="ParentPanel" runat="server">
        <ContentTemplate>
            <h2>Purchase Requisition</h2>
            <asp:Panel ID="prentpanel" runat="server">
                <asp:Label ID="lblParentReturn" runat="server" Font-Italic="True"></asp:Label>
                <br />
                <table style="width:100%;">
                    <tr>
                        <td class="auto-style6">PR No. :<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtPR" Display="None" ErrorMessage="PR No."></asp:RequiredFieldValidator>
                        </td>
                        <td class="auto-style5">
                            <asp:TextBox ID="txtPR" runat="server" CssClass="textbox"></asp:TextBox>
                        </td>
                        <td class="auto-style7">&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td class="auto-style6">
                            <asp:Panel ID="companypanel" runat="server">
                                <asp:RadioButton ID="rdKR" runat="server" Checked="True" GroupName="Companygrp" TabIndex="1" Text="Kenny Rogers" />
                                <br />
                                <asp:RadioButton ID="rdSB" runat="server" GroupName="Companygrp" TabIndex="2" Text="Seattles Best" />
                                <br />
                                <asp:RadioButton ID="rdKG" runat="server" GroupName="Companygrp" TabIndex="3" Text="Kanto Grill" />
                            </asp:Panel>
                        </td>
                        <td class="auto-style5">&nbsp;</td>
                        <td class="auto-style7">
                            <asp:Panel ID="Panel1" runat="server">
                                <asp:RadioButton ID="rdStd" runat="server" Checked="True" GroupName="prType" TabIndex="4" Text="Std. Food/Non Food" />
                                <br />
                                <asp:RadioButton ID="rdSmallwares" runat="server" GroupName="prType" TabIndex="5" Text="Smallwares" />
                                <br />
                                <asp:RadioButton ID="rdFixed" runat="server" GroupName="prType" TabIndex="6" Text="Fixed Assets" />
                            </asp:Panel>
                        </td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td class="auto-style6">Requisitioner :</td>
                        <td class="auto-style5">
                            <asp:TextBox ID="txtRequisitioner" runat="server" CssClass="textbox" TabIndex="7"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtRequisitioner" Display="None" ErrorMessage="Requisitioner "></asp:RequiredFieldValidator>
                        </td>
                        <td class="auto-style7">
                            <asp:Panel ID="Panel2" runat="server">
                                Priority :<asp:RadioButton ID="rbHigh" runat="server" GroupName="prior" TabIndex="8" Text="High" />
                                <asp:RadioButton ID="rbNorm" runat="server" GroupName="prior" TabIndex="8" Text="Normal" />
                            </asp:Panel>
                        </td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td class="auto-style6">Prepared By:
                            </td>
                        <td class="auto-style5">
                            <asp:TextBox ID="txtprepred" runat="server" CssClass="textbox" TabIndex="9"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtprepred" Display="None" ErrorMessage="Prepared By"></asp:RequiredFieldValidator>
                        </td>
                        <td class="auto-style7">Approved By:</td>
                        <td>
                            <asp:TextBox ID="txtApproved" runat="server" CssClass="textbox" TabIndex="10"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtApproved" Display="None" ErrorMessage="Approved By"></asp:RequiredFieldValidator>
                        </td>
                        <td style="white-space: nowrap">Recommended By:</td>
                        <td>
                            <asp:TextBox ID="txtRecommend" runat="server" CssClass="textbox" TabIndex="13"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td class="auto-style6">
                            &nbsp;</td>
                        <td class="auto-style5">
                            <asp:TextBox ID="clPrepared" runat="server" CssClass="textbox" TextMode="Date"></asp:TextBox>
                        </td>
                        <td class="auto-style7">
                            &nbsp;</td>
                        <td>
                            <asp:TextBox ID="clApprovd" runat="server" CssClass="textbox" TextMode="Date"></asp:TextBox>
                        </td>
                        <td>&nbsp;</td>
                        <td>
                            <asp:TextBox ID="clRecommend" runat="server" CssClass="textbox" TextMode="Date"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td class="auto-style6">
                            <h4>PURCHASING</h4>
                        </td>
                        <td class="auto-style5">&nbsp;</td>
                        <td class="auto-style7">&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td class="auto-style6">Canvassed By:</td>
                        <td class="auto-style5">
                            <asp:TextBox ID="txtCanvassed" runat="server" CssClass="textbox" TabIndex="15"></asp:TextBox>
                        </td>
                        <td class="auto-style7">Approve for P.O Issuance :<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="txtPOApproved" Display="None" ErrorMessage="Approved for P.O. Issuance"></asp:RequiredFieldValidator>
                        </td>
                        <td>
                            <asp:TextBox ID="txtPOApproved" runat="server" CssClass="textbox" TabIndex="16"></asp:TextBox>
                        </td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td class="auto-style6">
                            &nbsp;</td>
                        <td class="auto-style5">
                            <asp:TextBox ID="clcanvassed" runat="server" CssClass="textbox" TextMode="Date"></asp:TextBox>
                        </td>
                        <td class="auto-style7">
                            &nbsp;</td>
                        <td>
                            <asp:TextBox ID="clApprovedPO" runat="server" CssClass="textbox" TextMode="Date"></asp:TextBox>
                        </td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td class="auto-style6">
                            <asp:Button ID="Button2" runat="server" Text="Save Info" UseSubmitBehavior="False" />
                            
                        </td>
                        <td class="auto-style5">&nbsp;</td>
                        <td class="auto-style7">
                            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Management_Info_SysConnectionString %>" DeleteCommand="DELETE FROM pr_parents WHERE (pr_no = @pr_no)" InsertCommand="INSERT INTO pr_parents(pr_no, requisitioner, type, priority, prepared, prepared_date, recommend, recommend_date, approved, approved_date, canvassed, canvassed_date, approvePO, approvePO_date, time_stamp, uploaded_by, company) VALUES (@pr_no, @requisitioner, @type, @priority, @prepared, @prepared_date, @recommend, @recommend_date, @approved, @approved_date, @canvassed, @canvassed_date, @approvePO, @approvePO_date, @time_stamp, @uploaded_by, @company)" SelectCommand="SELECT * FROM [pr_parents]" UpdateCommand="UPDATE [pr_parents] SET [pr_no] = @pr_no, [requisitioner] = @requisitioner, [type] = @type, [priority] = @priority, [prepared] = @prepared, [prepared_date] = @prepared_date, [recommend] = @recommend, [recommend_date] = @recommend_date, [approved] = @approved, [approved_date] = @approved_date, [canvassed] = @canvassed, [canvassed_date] = @canvassed_date, [approvePO] = @approvePO, [approvePO_date] = @approvePO_date, [time_stamp] = @time_stamp WHERE [pr_key] = @pr_key">
                                <DeleteParameters>
                                    <asp:ControlParameter ControlID="txtPR" Name="pr_no" PropertyName="Text" />
                                </DeleteParameters>
                                <InsertParameters>
                                    <asp:ControlParameter ControlID="txtPR" Name="pr_no" PropertyName="Text" Type="String" />
                                    <asp:ControlParameter ControlID="txtRequisitioner" Name="requisitioner" PropertyName="Text" Type="String" />
                                    <asp:SessionParameter Name="type" SessionField="PR_Type" Type="String" />
                                    <asp:SessionParameter Name="priority" SessionField="Priority" Type="String" />
                                    <asp:ControlParameter ControlID="txtprepred" Name="prepared" PropertyName="Text" Type="String" />
                                    <asp:ControlParameter ControlID="clPrepared" Name="prepared_date" PropertyName="Text" Type="String" />
                                    <asp:ControlParameter ControlID="txtRecommend" Name="recommend" PropertyName="Text" Type="String" />
                                    <asp:ControlParameter ControlID="clRecommend" Name="recommend_date" PropertyName="Text" Type="String" />
                                    <asp:ControlParameter ControlID="txtApproved" Name="approved" PropertyName="Text" Type="String" />
                                    <asp:ControlParameter ControlID="clApprovd" Name="approved_date" PropertyName="Text" Type="String" />
                                    <asp:ControlParameter ControlID="txtCanvassed" Name="canvassed" PropertyName="Text" Type="String" />
                                    <asp:ControlParameter ControlID="clcanvassed" Name="canvassed_date" PropertyName="Text" Type="String" />
                                    <asp:ControlParameter ControlID="txtPOApproved" Name="approvePO" PropertyName="Text" Type="String" />
                                    <asp:ControlParameter ControlID="clApprovedPO" Name="approvePO_date" PropertyName="Text" Type="String" />
                                    <asp:SessionParameter Name="time_stamp" SessionField="time_stamp" Type="String" />
                                    <asp:SessionParameter Name="uploaded_by" SessionField="agent" />
                                    <asp:SessionParameter Name="company" SessionField="sel_company" />
                                </InsertParameters>
                                <UpdateParameters>
                                    <asp:Parameter Name="pr_no" Type="String" />
                                    <asp:Parameter Name="requisitioner" Type="String" />
                                    <asp:Parameter Name="type" Type="String" />
                                    <asp:Parameter Name="priority" Type="String" />
                                    <asp:Parameter Name="prepared" Type="String" />
                                    <asp:Parameter Name="prepared_date" Type="String" />
                                    <asp:Parameter Name="recommend" Type="String" />
                                    <asp:Parameter Name="recommend_date" Type="String" />
                                    <asp:Parameter Name="approved" Type="String" />
                                    <asp:Parameter Name="approved_date" Type="String" />
                                    <asp:Parameter Name="canvassed" Type="String" />
                                    <asp:Parameter Name="canvassed_date" Type="String" />
                                    <asp:Parameter Name="approvePO" Type="String" />
                                    <asp:Parameter Name="approvePO_date" Type="String" />
                                    <asp:Parameter Name="time_stamp" Type="String" />
                                    <asp:Parameter Name="pr_key" Type="Int64" />
                                </UpdateParameters>
                            </asp:SqlDataSource>
                            <asp:SqlDataSource ID="sqlParentCheck" runat="server" ConnectionString="<%$ ConnectionStrings:Management_Info_SysConnectionString %>" SelectCommand="SELECT * FROM [pr_parents] WHERE ([pr_no] = @pr_no)">
                                <SelectParameters>
                                    <asp:ControlParameter ControlID="txtPR" Name="pr_no" PropertyName="Text" Type="String" />
                                </SelectParameters>
                            </asp:SqlDataSource>
                        </td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                    </tr>
                </table>
            </asp:Panel>
            <hr />


<br />
            <asp:Panel ID="itemPanel" runat="server" Enabled="False">
                <h3 style="margin-top: 11px">Purchase Items</h3><table style="width:50%;">
                    <tr>
                        <td>Quantity</td>
                        <td>Unit</td>
                        <td>Description</td>
                        <td>Remarks</td>
                        <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td>
                            <asp:TextBox ID="txtqty" runat="server" Width="50px" CssClass="textbox" TextMode="Number"></asp:TextBox>
                        </td>
                        <td>
                            <asp:DropDownList ID="txtunit" runat="server">
                                <asp:ListItem Selected="True">PC</asp:ListItem>
                                <asp:ListItem>Unit</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                        <td>
                            <asp:TextBox ID="txtdescription" runat="server" CssClass="textbox"></asp:TextBox>
                        </td>
                        <td>
                            <asp:TextBox ID="txtremarks" runat="server" CssClass="textbox"></asp:TextBox>
                        </td>
                        <td>
                            <asp:Button ID="Button3" runat="server" Text="Add" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="lblqty" runat="server"></asp:Label>
                        </td>
                        <td>&nbsp;</td>
                        <td>
                            <asp:Label ID="lblitemdesc" runat="server"></asp:Label>
                        </td>
                        <td>&nbsp;</td>
                        <td>
                            <asp:Label ID="lblitemdesc0" runat="server"></asp:Label>
                        </td>
                    </tr>
                    </table>
                
                <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="po_itemkey" DataSourceID="sqlItem" ForeColor="#333333" GridLines="None">
                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                    <Columns>
                        <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                        <asp:BoundField DataField="po_itemkey" HeaderText="po_itemkey" InsertVisible="False" ReadOnly="True" SortExpression="po_itemkey" Visible="False" />
                        <asp:BoundField DataField="po_no" HeaderText="po_no" SortExpression="po_no" Visible="False" />
                        <asp:BoundField DataField="quantity" HeaderText="Quantity" SortExpression="quantity" />
                        <asp:BoundField DataField="unit" HeaderText="Unit" SortExpression="unit" />
                        <asp:BoundField DataField="description" HeaderText="Description" SortExpression="description" />
                        <asp:BoundField DataField="remarks" HeaderText="Remarks" SortExpression="remarks" />
                        <asp:BoundField DataField="time_stamp" HeaderText="time_stamp" SortExpression="time_stamp" Visible="False" />
                    </Columns>
                    <EditRowStyle BackColor="#999999" />
                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                    <SortedAscendingCellStyle BackColor="#E9E7E2" />
                    <SortedAscendingHeaderStyle BackColor="#506C8C" />
                    <SortedDescendingCellStyle BackColor="#FFFDF8" />
                    <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                </asp:GridView>
                <br />
                <asp:SqlDataSource ID="sqlItem" runat="server" ConnectionString="<%$ ConnectionStrings:Management_Info_SysConnectionString %>" DeleteCommand="DELETE FROM pr_items WHERE (po_no = @po_no)" InsertCommand="INSERT INTO [pr_items] ([po_no], [quantity], [unit], [description], [remarks], [time_stamp]) VALUES (@po_no, @quantity, @unit, @description, @remarks, @time_stamp)" SelectCommand="SELECT * FROM [pr_items] WHERE ([po_no] = @po_no)" UpdateCommand="UPDATE [pr_items] SET [po_no] = @po_no, [quantity] = @quantity, [unit] = @unit, [description] = @description, [remarks] = @remarks, [time_stamp] = @time_stamp WHERE [po_itemkey] = @po_itemkey">
                    <DeleteParameters>
                        <asp:ControlParameter ControlID="txtPR" Name="po_no" PropertyName="Text" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:ControlParameter ControlID="txtPR" Name="po_no" PropertyName="Text" Type="String" />
                        <asp:ControlParameter ControlID="txtqty" Name="quantity" PropertyName="Text" Type="String" />
                        <asp:ControlParameter ControlID="txtunit" Name="unit" PropertyName="Text" Type="String" />
                        <asp:ControlParameter ControlID="txtdescription" Name="description" PropertyName="Text" Type="String" />
                        <asp:ControlParameter ControlID="txtremarks" Name="remarks" PropertyName="Text" Type="String" />
                        <asp:SessionParameter Name="time_stamp" SessionField="time_stamp" Type="String" />
                    </InsertParameters>
                    <SelectParameters>
                        <asp:ControlParameter ControlID="txtPR" Name="po_no" PropertyName="Text" Type="String" />
                    </SelectParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="po_no" Type="String" />
                        <asp:Parameter Name="quantity" Type="String" />
                        <asp:Parameter Name="unit" Type="String" />
                        <asp:Parameter Name="description" Type="String" />
                        <asp:Parameter Name="remarks" Type="String" />
                        <asp:Parameter Name="time_stamp" Type="String" />
                        <asp:Parameter Name="po_itemkey" Type="Int64" />
                    </UpdateParameters>
                </asp:SqlDataSource>
                
            </asp:Panel>
            <hr />
            <asp:Button ID="Button4" runat="server" Enabled="False" Text="Cancel" />
            <asp:Button ID="Button5" runat="server" Text="Close" />
<br />

        </ContentTemplate>
    </asp:UpdatePanel>
    <br />
</asp:Content>

